package monitor

type empty struct {}

type Monitor struct {
	ch chan empty
}

func New () *Monitor {
	return &Monitor{nil}
}

func (m *Monitor) Wait () {

	if m.ch == nil {
		m.ch = make(chan empty)
	}

	m.ch <- empty{}
}

func (m *Monitor) Signal() {

	if m.ch == nil {
		return
	}

	for {
		select {
		case _ = <-m.ch:
		default:
			return
		}
	}
}
